#include "threadPool.hpp"
#include <ctime>
#include"Task.hpp"
#include <unistd.h>
#include <cstdlib>
#include "log.hpp"
int main()
{
    srand((unsigned long)time(nullptr) ^ 45441);

    //ThreadPool<Task>* tp = new ThreadPool<Task>;
    ThreadPool<Task>::GetThreadPool();

    ThreadPool<Task>::GetThreadPool()->run();
    while(true)
    {
        int x= rand()%100 + 1;
        int y = rand()%50 +1;
        Task t(x,y,[](int x,int y)->int{return x + y;});

        ThreadPool<Task>::GetThreadPool()->pushTask(t);
        logMessage(DEBUG,"制作任务完成: %d+%d=?",x,y);
        //std::cout << "任务制作完成" << x << " + " << y << " = " << " ? " << std::endl;
        usleep(10000);
    }
    return 0;
}